package com.gm.baseplatform.core.tree;

import java.util.List;

import net.sf.json.JSONObject;

public class TreeNode {
	
	public static final String NODE_STATE_OPEN = "open";
	public static final String NODE_STATE_CLOSE = "closed";
	
	private String id;
	private String text;
	private String state;
	private boolean checked;
	private boolean hasChildren;
	private String attributes;
	private List<TreeNode> children;
	
	public List<TreeNode> getChildren() {
		return children;
	}

	public void setChildren(List<TreeNode> children) {
		this.children = children;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public boolean isChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

	public String getAttributes() {
		return attributes;
	}

	public void setAttributes(String attributes) {
		this.attributes = attributes;
	}

	public boolean isHasChildren() {
		return hasChildren;
	}

	public void setHasChildren(boolean hasChildren) {
		this.hasChildren = hasChildren;
	}
	
	public String toJsonText() {
		return JSONObject.fromObject(this).toString();
	}
}
